(: Ex 2 :)
<Big_countries_with_no_Danube>
{
(: 
   opening xml database mondial-europe
   getting river node with name child node equals to Donau
   getting country attribute
   split string in token base on space character
:)
let $x := tokenize(doc('/db/mondial/mondial-europe.xml')/mondial/river[name='Donau']/@country, "\s")
(: 
   getting countries with population child node having a value >= 30000000 
   and attribute car_code not in tokenized string retrived before
   ordered by country name
:)
for $c in doc('/db/mondial/mondial-europe.xml')/mondial/country[population >= 30000000]
where not($c/@car_code = $x)
order by $c/name ascending
(: 
   return a node country having car_code attribute equals to car_code of country matching the request, child node name equals to the country name and child node population equals to the population of that country
:)
return <country car_code="{$c/@car_code}">{$c/name}{$c/population}</country>
}
</Big_countries_with_no_Danube>

